//
//  ClassflyCollectionCell.m
//  A_Comic
//
//  Created by sos on 16/1/21.
//  Copyright © 2016年 sos. All rights reserved.
//

#import "ClassflyCollectionCell.h"

@implementation ClassflyCollectionCell
- (void)dealloc
{
    [_img release];
    [_label release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.img = [[UIImageView alloc]init];
//        self.img.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.img];
        [self.img release];
        
        
        self.label = [[UILabel alloc]init];
//        self.label.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:self.label];
        [self.label release];
        
        
        
    }
    return self;
}


-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    self.img.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.width);
    self.img.layer.cornerRadius = layoutAttributes.frame.size.width/2;
    self.img.clipsToBounds = YES;
    self.img.layer.borderWidth = 5;
    self.img.layer.borderColor = [UIColor grayColor].CGColor;
    
    self.label.frame = CGRectMake(0, self.img.frame.size.height+10, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height/5);
    self.label.textAlignment = NSTextAlignmentCenter;
    
    
    
    
    
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
